﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using CourseSystem.Core.BLL;

namespace CourseSystem.Common.Helpers
{
    public class ChapterHelper
    {
        public static List<SelectListItem> GetChapter(bool needDef = true)
        {
            var colList = ChapterBLL.GetAll().OrderBy(o=>o.OrderId);
            var re = colList.Select(item => new SelectListItem { Value = item.Id.ToString(), Text = item.Name }).ToList();
            if (needDef)
                re.Insert(0, new SelectListItem { Text = "请选择", Value = "-1" });
            return re;
        }
    }
}
